// Copyright 叶湘 ( weixin:yexiang841, email:yexiang841@qq.com ), Shitouren Studio. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Hit/Q3D_CPPU_HitType.h"
#include "Property/Q3D_CPPE_PropertyName.h"
#include "Q3D_CPPC_HitCauser.generated.h"

class UQ3D_CPPU_Hit;

/**
 *
 */
UCLASS(Blueprintable, ClassGroup = (Q3D), meta = (Tooltip = "Hit 引发者组件(C++)", BlueprintSpawnableComponent))
class Q3D_LIB_API UQ3D_CPPC_HitCauser : public UActorComponent
{
	GENERATED_BODY()

public:
	// Sets default values for this component's properties
	UQ3D_CPPC_HitCauser();

public: // 这部分对构造函数暴露
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Q3D_HitCauser, meta = (Tooltip = "是否忽略命中 Maker", ExposeOnSpawn = "true"))
	bool Bool_Ignore_Maker;

public:
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Q3D_HitCauser, meta = (Tooltip = "命中映射表，Key 是 ID，Value 是命中"))
	TMap<FName, UQ3D_CPPU_Hit *> Map_Name_To_Ptr_U_Hit;

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;

public:
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;

public:
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = Q3D_HitCauser, meta = (Tooltip = "携带一个命中"))
	void Q3D_F_Hit_Set(const TMap<FName, UQ3D_CPPU_Hit *> &map_name_to_ptr_u_hit_param, UPARAM(DisplayName = "boool_success") bool &bool_success, UPARAM(DisplayName = "string_log") FString &string_log);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = Q3D_HitCauser, meta = (Tooltip = "向目标发送一个命中"))
	void Q3D_F_Hit_SetToTarget(AActor *ptr_a_hit_target, UPARAM(DisplayName = "boool_success") bool &bool_success, UPARAM(DisplayName = "string_log") FString &string_log);
};
